//
//  SettingHeaderView.swift
//  taxiDriver
//
//  Created by 小哥哥 on 2023/12/21.
//

import SwiftUI

import Combine
import ComposableArchitecture
import CoreLocation
import JZLocationConverterSwift
import Localize_Swift
import Logging
import MapKit
import SheeKit
import SwiftDate
import SwiftUI
import Localize_Swift
struct SettingHeaderView: View {
    var geometry : GeometryProxy
    var presentationMode : Binding<PresentationMode>
    
    var body: some View {
        ZStack(alignment: .topLeading, content: {
            VStack(alignment: .leading){
                Image(systemName: "chevron.backward").foregroundColor(Color(hex: 0x333333))
                    .frame(width: 30,height: 30)
                    .aspectRatio(contentMode: .fit).onTapGesture {
                        presentationMode.wrappedValue.dismiss()
                        
                    }
                HStack(spacing: 20){
                    Image("appstore")
                        .resizable()
                        .frame(width: 80,height: 80)
                        .aspectRatio(contentMode: .fit)
                        .cornerRadius(40).background(.clear)
                    VStack(alignment: .leading,spacing: 20){
                        Text("老挝出行专家")
                            .font(.system(size: 20) .bold())
                            .foregroundColor(.black)
                        Text("我们带你去老挝的任何地方!")
                            .font(.system(size: 16))
                            .foregroundColor(.black)
                    }
                    Spacer()
                    
                }
                HStack(spacing: 15){
                    
                    NavigationLink (destination:  OrdersView()){
                        HStack(spacing: 5){
                            Image("我的订单")
                                .resizable()
                                .frame(width: 40,height: 40)
                            VStack(alignment:.leading, spacing: 5){
                                Text("我的订单")
                                    .font(.system(size: 16) .bold())
                                    .foregroundColor(.black)
                                Text("订单查询与管理")
                                    .font(.system(size: 12))
                                    .foregroundColor(.black)
                                
                            }
                        }
                        .frame(maxWidth: .infinity)
                        .padding(.horizontal,15)
                        .padding(.vertical,15)
                        .background(.white)
                        .cornerRadius(12)
                    }
                    
                    //                        Spacer()
                    
                    NavigationLink (destination:  PrivateAddressView(region: MKCoordinateRegion(
                        center: CLLocationCoordinate2D(latitude: ViewModel.shared.lastLocation.latitude, longitude: ViewModel.shared.lastLocation.longitude),
                        span: MKCoordinateSpan(latitudeDelta: 0.005, longitudeDelta: 0.005)
                    ), selectCoordinate: CarOrder.shared.startPos!, selectType: "start") {
                        
                    }){
                        HStack(spacing: 5){
                            Image("我的地址")
                                .resizable()
                                .frame(width: 40,height: 40)
                            VStack(alignment:.leading, spacing: 5){
                                Text("我的地址")
                                    .font(.system(size: 16) .bold())
                                    .foregroundColor(.black)
                                Text("地址设置与管理")
                                    .font(.system(size: 12))
                                    .foregroundColor(.black)
                                
                            }
                        }
                        .frame(maxWidth: .infinity)
                        .padding(.horizontal,15)
                        .padding(.vertical,15)
                        .background(.white)
                        .cornerRadius(12)
                        .padding(.trailing,0)
                    }
                }
            }.padding(.horizontal,15).frame(width: geometry.size.width,height: 160 + geometry.safeAreaInsets.top)
        }
        )
        
    }
}

//
//#Preview {
//    SettingHeaderView()
//}
